import Vue from 'vue'
import Vuex from 'vuex'
import getters from './getters'
import mutations from './mutations'
import * as actions from './actions'

Vue.use(Vuex)

let _langObj = JSON.parse(window.localStorage.getItem('langObj'));

const state = {
  userToken: '',
  sysLanguage: {
    active: 0,
    list: [
      // {name: '简体',value: '0'},
      // {name: '繁體',value: '1'},
      // {name: 'English',value: '2'}
    ]
  },
  langObj: _langObj, //系统字体包对象
  isFullScreenTable: false, //是否全屏表格
  isMask: false, //是否有透明遮罩
  isLoading: false, //是否显示Loading
  isToasting: false,//是否显示Toast
  isHideSideBar: false, //是否隐藏侧边栏
  toast: { //toast的相关设置
    info: '完成操作',
    icon: 0,
    time: 1000,
    onHidden: null
  },
  allMenu: { // 所有菜单
    list: [],
    active: 0
  },
  sideMenu: { //侧边栏菜单项
    list: [],
    firstIndex: 0,
  },
  tab: {  //tab栏
    list: [],
    active: 0,
    isSynchronize: false
  },
  modal: { // 用于存储 多层modal情况下 的数据
    active: [],
    deactive: []
  },
  dialog: {
    isDialog: false,
    title: _langObj ? _langObj.normal_label_warm_tips : '温馨提示',
    contents: '',
    btnGroup: [_langObj ? _langObj.bt_confirm : '确认', _langObj ? _langObj.bt_cancel : '取消'],
    confirmCallback: null,
    cancelCallback: null
  },
  isSyncUserSetting: false
}

export default new Vuex.Store({
  state,
  getters,
  actions,
  mutations
})
